//Thanks:https://gist.github.com/theburningmonk/6401183
class MyClass {
  static final MyClass _singleton = new MyClass._internal();
  factory MyClass() => _singleton;
  MyClass._internal() {}
}

class MyClass2 {}

main() {
  // consuming code
  MyClass myObj = new MyClass(); // get back the singleton
  MyClass myObj2 = new MyClass(); // still getting back the singleton
  print(myObj == myObj2); //true

  MyClass2 myObj21 = new MyClass2();
  MyClass2 myObj22 = new MyClass2();
  print(myObj21 == myObj22); //false
}
//EOP
